package com.myapp.struts.menu;

import java.util.ArrayList;

public class MenuFormat extends IMenuFormatter {

    @Override
    public String FormatMenu(ArrayList<FoodItems> fooditem, String format, String outLoc) {
        String fileName = "";
        if (format.equals(Constants.HTML)) {
            JavaToHTML a = new JavaToHTML();
            try {
                fileName = a.formatHTML(fooditem, outLoc);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } else if (format.equals(Constants.TEXT)) {
            JavaToText a = new JavaToText();
            try {
                fileName = a.formatText(fooditem, outLoc);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        } else {
            JavaToXML a = new JavaToXML();
            fileName = a.formatXML(fooditem, outLoc);
        }
        return fileName;
    }
}
